﻿using System.Collections.Generic;
using System.Threading.Tasks;
using BCEntity.Common.Area;

namespace BCData.Common.Area
{
    public interface ICountyData
    {
        bool Add(CountyEntity entity);

        bool Update(CountyEntity entity);

        bool Delete(string countyCode);

        CountyEntity GetCounty(long countyId);

        CountyEntity GetCounty(string countyCode);

        IEnumerable<CountyEntity> GetCounties(string cityCode);

        IEnumerable<CountyEntity> GetCounties(long cityId);

        IEnumerable<CountyEntity> GetCounties(string provinceCode, string cityCode, string countyCode, int index, int size, out int dataCount);

        bool CheckExistsById(long countyId);
        bool CheckExistsByCode(string countyCode);

        bool CheckCountyCodeExists(string countyCode, string cityCode);

        bool CheckCityCodeExists(string cityCode);

        IEnumerable<CountyEntity> GetCounty(string provinceName, string cityName);
        /// <summary>
        /// 修改区县议价
        /// </summary>
        /// <param name="countyCode">区县Id</param>
        /// <param name="isNegotiatedPrice">需要议价</param>
        /// <returns></returns>
        bool UpdateCountyNegotiatedPrice(string countyCode, bool isNegotiatedPrice);

        /// <summary>
        /// 检查区县信息是否存在
        /// </summary>
        /// <param name="countyUuid">区县UUID</param>
        /// <param name="countyName">区县名称</param>
        /// <param name="countyCode">区县编码</param>
        /// <param name="cityCode">市编码</param>
        /// <returns></returns>
        Task<CountyEntity> GetCountyAsync(string countyUuid, string countyName, string countyCode, string cityCode);

        /// <summary>
        /// 添加区县信息
        /// </summary>
        /// <param name="entity">区县信息</param>
        /// <param name="batchNo">批号</param>
        /// <returns></returns>
        Task<int> AddCountyAsync(CountyEntity entity, string batchNo);

        /// <summary>
        /// 更新区县信息
        /// </summary>
        /// <param name="entity">区县信息</param>
        /// <param name="batchNo">批号</param>
        /// <param name="countyCode">旧编码</param>
        /// <param name="countyName">旧名称</param>
        /// <param name="isMatch">是否匹配上</param>
        /// <returns></returns>
        Task<int> UpdateCountyAsync(CountyEntity entity, string batchNo, CountyEntity countryResult, bool? isMatch);

        /// <summary>
        /// 不存在新地图信息插入未匹配上的数据
        /// </summary>
        /// <param name="batchNo">批号</param>
        /// <returns></returns>
        Task<bool> UpdateIsEnabledAsync(string batchNo);
        
        /// <summary>
        /// 获取区县列表
        /// </summary>
        /// <returns></returns>
        Task<IEnumerable<CountyEntity>> GetList();
    }
}
